home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_Arrays_JScript.asp < prev    next >
Encoding:
Text File  |  1998-05-29  |  2.6 KB  |  110 lines

  1. <%@ LANGUAGE = JScript %>
  2.  
  3. <!*************************
  4. This sample is provided for educational purposes only. It is not intended to be 
  5. used in a production environment, has not been tested in a production environment, 
  6. and Microsoft will not provide technical support for it. 
  7. *************************>
  8.  
  9. <%
  10.     //Declare a simple fixed-size array.
  11.     aFixed = new Array(4);
  12.  
  13.     //Declare a dynamic (resizable) array.
  14.     aColors = new Array();
  15.  
  16.  
  17.     //Assign values to fixed-size array.
  18.  
  19.     aFixed[0] = "Fixed";
  20.     aFixed[1] = "Size";
  21.     aFixed[2] = "Array";
  22.     aFixed[3] = "Session ID: " + Session.SessionID;
  23.  
  24.  
  25.     //Store values representing a simple color table
  26.     //to each of the elements.
  27.  
  28.     aColors[0] = "RED"; 
  29.     aColors[1] = "GREEN"; 
  30.     aColors[2] = "BLUE";  
  31.     aColors[3] = "AQUA";
  32.     aColors[4] = "YELLOW";
  33.     aColors[5] = "FUCHSIA";
  34.     aColors[6] = "GRAY";
  35.     aColors[7] = "LIME";
  36.     aColors[8] = "MAROON";
  37.     aColors[9] = "NAVY";
  38.     aColors[10] = "OLIVE";
  39.     aColors[11] = "PURPLE";
  40.     aColors[12] = "SILVER";
  41.     aColors[13] = "TEAL";
  42. %>
  43.  
  44. <HTML>
  45.     <HEAD>
  46.         <TITLE>Array Sample</TITLE>
  47.     </HEAD>
  48.  
  49.     <BODY BGCOLOR="White" TOPMARGIN="10" LEFTMARGIN="10">
  50.  
  51.         <!-- Display header. -->
  52.  
  53.         <FONT SIZE="4" FACE="Arial, Helvetica">
  54.         <B>Array Sample</B></FONT><BR>
  55.       
  56.         <HR SIZE="1" COLOR="#000000">
  57.  
  58.         <TABLE CELLPADDING=10 BORDER=1 CELLSPACING=0>
  59.             <TR>
  60.                 <TD BGCOLOR=WHITE>
  61.                     <FONT SIZE="3" FACE="Arial, Helvetica">
  62.                         <B>A Resizable Array</B><BR>
  63.                     </FONT>
  64.                 </TD>
  65.  
  66.                 <TD BGCOLOR=WHITE>
  67.                     <FONT SIZE="3" FACE="Arial, Helvetica">
  68.                         <B>A Fixed Size (4 element) Array</B><BR>
  69.                     </FONT>
  70.                 </TD>
  71.             </TR>
  72.  
  73.             <TR>                
  74.                 <TD>
  75.                     <%
  76.                         //Get Array Size.
  77.  
  78.                         intColors = aColors.length;
  79.                          
  80.                         //Print out contents of resizable array
  81.                         //into table column.
  82.  
  83.                         for(i = 0; i < intColors; i++)
  84.                         {
  85.                             Response.Write("<FONT COLOR=" + aColors[i] + ">" + aColors[i] + "<br></FONT>");
  86.                         } 
  87.                     %>
  88.                 </TD>
  89.  
  90.                 <TD>
  91.                     <%
  92.                         //Get Array Size.                        
  93.                         
  94.                         intColors = aFixed.length;
  95.  
  96.  
  97.                         //Print out contents of fixed array into
  98.                         //table column.
  99.  
  100.                         for(i = 0; i < intColors; i++)
  101.                         {
  102.                             Response.Write(aFixed[i] + "<br>");
  103.                         } 
  104.                     %>
  105.                 </TD>
  106.             </TR>
  107.         </TABLE>
  108.     </BODY>
  109. </HTML>
  110.